package com.quanxiaoha.weblog.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 喜欢/收藏类型枚举
 */
@Getter
@AllArgsConstructor
public enum FavoriteTypeEnum {

    LIKE(1, "喜欢"),
    FAVORITE(2, "收藏");

    private final Integer value;
    private final String description;

    /**
     * 根据值获取枚举
     */
    public static FavoriteTypeEnum valueOf(Integer value) {
        for (FavoriteTypeEnum typeEnum : FavoriteTypeEnum.values()) {
            if (typeEnum.getValue().equals(value)) {
                return typeEnum;
            }
        }
        return null;
    }
}
